<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<div class="easyui-layout" fit="true">
  <div region="center" style="padding:0px;border:0px">
  <t:datagrid name="bnsMessageList" checkbox="true" fitColumns="false" title="消息表" actionUrl="bnsMessageController.do?datagrid" idField="id" fit="true" queryMode="group">
   <t:dgCol title="主键"  field="id"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="标题"  field="title"    queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="内容"  field="content"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="消息类型"  field="messageTypes"    queryMode="single" dictionary="msgType" width="120"></t:dgCol>
   <t:dgCol title="发布时间"  field="createDate" formatter="yyyy-MM-dd"   queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="发布人"  field="createName"    queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="发布人登录名称"  field="createBy"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="接收人id"  field="receiveId"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="接收人"  field="receiveName"    queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="是否发送"  field="states"   query="true" queryMode="single" dictionary="sf_yn" width="120"></t:dgCol>
   <t:dgCol title="排序"  field="sort"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="更新人名称"  field="updateName"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="更新人登录名称"  field="updateBy"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="更新日期"  field="updateDate" formatter="yyyy-MM-dd" hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="是否已读"  field="isRead"   query="true" queryMode="single" dictionary="sf_yn" width="120"></t:dgCol>
   <t:dgCol title="操作" field="opt" width="100"></t:dgCol>
   <t:dgDelOpt title="删除" url="bnsMessageController.do?doDel&id={id}" />
   <t:dgToolBar title="录入" icon="icon-add" url="bnsMessageController.do?goAdd" funname="add" width="780" height="630"></t:dgToolBar>
   <t:dgToolBar title="编辑" icon="icon-edit" url="bnsMessageController.do?goUpdate" funname="update" width="780" height="630"></t:dgToolBar>
   <t:dgToolBar title="批量删除"  icon="icon-remove" url="bnsMessageController.do?doBatchDel" funname="deleteALLSelect"></t:dgToolBar>
   <t:dgToolBar title="查看" icon="icon-search" url="bnsMessageController.do?goUpdate" funname="detail" width="780" height="630"></t:dgToolBar>
<%--    <t:dgToolBar title="导入" icon="icon-put" funname="ImportXls"></t:dgToolBar> --%>
<%--    <t:dgToolBar title="导出" icon="icon-putout" funname="ExportXls"></t:dgToolBar> --%>
<%--    <t:dgToolBar title="模板下载" icon="icon-putout" funname="ExportXlsByT"></t:dgToolBar> --%>
   	<t:dgToolBar title="发送" icon="icon-redo"  url="bnsMessageController.do?doSend" funname="send" ></t:dgToolBar>
  </t:datagrid>
  </div>
 </div>
 <script src = "webpage/com/buss/message/bnsMessageList.js"></script>		
 <script type="text/javascript">
 $(document).ready(function(){
 		//给时间控件加上样式
 			$("#bnsMessageListtb").find("input[name='createDate']").attr("class","Wdate").attr("style","height:20px;width:90px;").click(function(){WdatePicker({dateFmt:'yyyy-MM-dd'});});
 			$("#bnsMessageListtb").find("input[name='updateDate']").attr("class","Wdate").attr("style","height:20px;width:90px;").click(function(){WdatePicker({dateFmt:'yyyy-MM-dd'});});
 });
 

/**
 * 多记录发送消息
 * @param title
 * @param url
 * @param gname
 * @return
 */
var gridname="";
function send(title,url,gname) {
	gridname=gname;
    var ids = [];
    var rows = $("#"+gname).datagrid('getSelections');
    if (rows.length > 0) {
    	$.dialog.confirm('你确定发送吗?', function(r) {
		   if (r) {
				for ( var i = 0; i < rows.length; i++) {
					ids.push(rows[i].id);
				}
				$.ajax({
					url : url,
					type : 'post',
					data : {
						ids : ids.join(',')
					},
					cache : false,
					success : function(data) {
						var d = $.parseJSON(data);
						if (d.success) {
							var msg = d.msg;
							tip(msg);
							reloadTable();
							$("#"+gname).datagrid('unselectAll');
							ids='';
						}
					}
				});
			}
		});
	} else {
		tip("请选择需要发送的数据");
	}
}
 
// //导入
// function ImportXls() {
// 	openuploadwin('Excel导入', 'bnsMessageController.do?upload', "bnsMessageList");
// }

// //导出
// function ExportXls() {
// 	JeecgExcelExport("bnsMessageController.do?exportXls","bnsMessageList");
// }

// //模板下载
// function ExportXlsByT() {
// 	JeecgExcelExport("bnsMessageController.do?exportXlsByT","bnsMessageList");
// }
 </script>